/*	
	在Express框架中使用Socket.Io
*/

var http = require("http");
var express = require("express");
var sio = require("socket.io");

var app = express();
var server = http.createServer(app).listen(1337);

app.get('/', function(req, res){
	res.sendfile('./4_emitClient.html');
});

var socketSer = sio.listen(server);
socketSer.on('connection', function(socket) {
	socket.emit('news', {hello: '你好'});
	socket.on('my other event', function(data){
		console.log('服务器接收到数据：%j', data);
	});
});